/*
 * kernel.c
 *
 *  Created on: 01/01/2009
 *      Author: Marcelo
 */

#include "include/kernel.h"
#include "include/types.h"
#include "include/io.h"

static BYTE appMessage;
//struct CPUState CpuState;


static void getCPUState()
{ /*
  CpuState.Carry_Flag =  bitState(__SREG__, 0);
  CpuState.Zero_Flag = bitState(__SREG__, 1);
  //CpuState->Negative_Flag = bitState(__SREG__, 2);
  CpuState.Negative_Flag = 1;
  */
  //CpuState.Negative_Flag = (__SREG__) & (1 << 2);
}

static void postMessage(BYTE KernelMessage)
{
  appMessage = KernelMessage;
}

static BYTE getMessage()
{
  return appMessage;
}

int main(void)
{
  initialize();
  postMessage(XM_RUN);
  while (getMessage() == XM_RUN)
    {
      //getCPUState();
      //if (CpuState.Negative_Flag)
        //postMessage(XM_QUIT);
      run();
    }
  terminate();
  return 0;
}

